|
1
|
|
|
/** |
|
2
|
|
|
* This file is part of the O2System Venus UI Framework package. |
|
3
|
|
|
* |
|
4
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
5
|
|
|
* file that was distributed with this source code. |
|
6
|
|
|
* |
|
7
|
|
|
* @author Steeve Andrian Salim |
|
8
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim |
|
9
|
|
|
*/ |
|
10
|
|
|
// ------------------------------------------------------------------------ |
|
11
|
|
|
import Form from 'o2system-venus-form'; |
|
12
|
|
|
import $ from 'jquery'; |
|
13
|
|
|
import toastr from 'toastr'; |
|
14
|
|
|
import Sidebar from './Partials/Sidebar'; |
|
15
|
|
|
window.JSZip = require('jszip'); |
|
16
|
|
|
require("./Components/js/pdfmake.js"); |
|
17
|
|
|
require( 'datatables.net-bs4' ); |
|
18
|
|
|
require( 'datatables.net-autofill-bs4' ); |
|
19
|
|
|
require( 'datatables.net-buttons-bs4' ); |
|
20
|
|
|
require( 'datatables.net-buttons/js/buttons.colVis.js' ); |
|
21
|
|
|
require( 'datatables.net-buttons/js/buttons.flash.js' ); |
|
22
|
|
|
require( 'datatables.net-buttons/js/buttons.html5.js' ); |
|
23
|
|
|
require( 'datatables.net-buttons/js/buttons.print.js' ); |
|
24
|
|
|
require( 'datatables.net-colreorder-bs4' ); |
|
25
|
|
|
require( 'datatables.net-fixedcolumns-bs4' ); |
|
26
|
|
|
require( 'datatables.net-fixedheader-bs4' ); |
|
27
|
|
|
require( 'datatables.net-keytable-bs4' ); |
|
28
|
|
|
require( 'datatables.net-responsive-bs4' ); |
|
29
|
|
|
require( 'datatables.net-rowgroup-bs4' ); |
|
30
|
|
|
require( 'datatables.net-rowreorder-bs4' ); |
|
31
|
|
|
require( 'datatables.net-scroller-bs4' ); |
|
32
|
|
|
require( 'datatables.net-select-bs4' ); |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Class Admin |
|
36
|
|
|
*/ |
|
37
|
|
|
class Admin { |
|
38
|
|
|
constructor() { |
|
39
|
|
|
window.$ = window.jQuery = $; |
|
40
|
|
|
const sidebarPartial = new Sidebar; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Run sidebar toggle |
|
44
|
|
|
*/ |
|
45
|
|
|
sidebarPartial.toggle(); |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Run toggle on window resize |
|
49
|
|
|
*/ |
|
50
|
|
|
$(window).resize(function () { |
|
51
|
|
|
sidebarPartial.toggle(); |
|
52
|
|
|
}); |
|
53
|
|
|
|
|
54
|
|
|
$('.datatables-basic, .datatables-fixed').prop('width', '100%'); |
|
55
|
|
|
var printCounter = 0; |
|
56
|
|
|
var datatablesBasic = $('.datatables-basic').DataTable({ |
|
57
|
|
|
"searching": false, |
|
58
|
|
|
"lengthChange": false, |
|
59
|
|
|
"scrollX": true, |
|
60
|
|
|
//dom: 'Bfrtip', |
|
61
|
|
|
buttons: [ |
|
62
|
|
|
{ |
|
63
|
|
|
extend: 'copy', |
|
64
|
|
|
className: 'btn btn-default' |
|
65
|
|
|
}, |
|
66
|
|
|
{ |
|
67
|
|
|
extend: 'excel', |
|
68
|
|
|
className: 'btn btn-default' , |
|
69
|
|
|
footer: true, |
|
70
|
|
|
messageTop: function () { |
|
71
|
|
|
var headerPeriode = $('.header-periode').text(); |
|
72
|
|
|
return headerPeriode; |
|
73
|
|
|
}, |
|
74
|
|
|
|
|
75
|
|
|
messageBottom: function () { |
|
76
|
|
|
|
|
77
|
|
|
var footerPrint = $('.footer-print').text(); |
|
78
|
|
|
|
|
79
|
|
|
return footerPrint; |
|
80
|
|
|
}, |
|
81
|
|
|
}, |
|
82
|
|
|
{ |
|
83
|
|
|
extend: 'csv', |
|
84
|
|
|
className: 'btn btn-default' |
|
85
|
|
|
}, |
|
86
|
|
|
{ |
|
87
|
|
|
extend: 'pdf', |
|
88
|
|
|
className: 'btn btn-default', |
|
89
|
|
|
footer: true, |
|
90
|
|
|
messageTop: function () { |
|
91
|
|
|
printCounter++; |
|
92
|
|
|
|
|
93
|
|
|
var headerPrint = $('.header-print').html(); |
|
94
|
|
|
var headerPeriode = $('.header-periode').html(); |
|
95
|
|
|
if ( printCounter === 1 ) { |
|
96
|
|
|
return headerPrint+headerPeriode+'This is the first time you have printed this document.'; |
|
97
|
|
|
} |
|
98
|
|
|
else { |
|
|
|
|
|
|
99
|
|
|
return headerPrint+headerPeriode+'You have printed this document '+printCounter+' times'; |
|
100
|
|
|
} |
|
101
|
|
|
}, |
|
102
|
|
|
|
|
103
|
|
|
messageBottom: function () { |
|
104
|
|
|
|
|
105
|
|
|
var footerPrint = $('.footer-print').html(); |
|
106
|
|
|
|
|
107
|
|
|
return footerPrint; |
|
108
|
|
|
}, |
|
109
|
|
|
|
|
110
|
|
|
}, |
|
111
|
|
|
{ |
|
112
|
|
|
extend: 'print', |
|
113
|
|
|
className: 'btn btn-default', |
|
114
|
|
|
footer: true, |
|
115
|
|
|
messageTop: function () { |
|
116
|
|
|
printCounter++; |
|
117
|
|
|
|
|
118
|
|
|
var headerPrint = $('.header-print').html(); |
|
119
|
|
|
var headerPeriode = $('.header-periode').html(); |
|
120
|
|
|
if ( printCounter === 1 ) { |
|
121
|
|
|
return headerPrint+headerPeriode+'This is the first time you have printed this document.'; |
|
122
|
|
|
} |
|
123
|
|
|
else { |
|
|
|
|
|
|
124
|
|
|
return headerPrint+headerPeriode+'You have printed this document '+printCounter+' times'; |
|
125
|
|
|
} |
|
126
|
|
|
}, |
|
127
|
|
|
|
|
128
|
|
|
messageBottom: function () { |
|
129
|
|
|
|
|
130
|
|
|
var footerPrint = $('.footer-print').html(); |
|
131
|
|
|
|
|
132
|
|
|
return footerPrint; |
|
133
|
|
|
}, |
|
134
|
|
|
}, |
|
135
|
|
|
], |
|
136
|
|
|
drawCallback: function (settings) { |
|
|
|
|
|
|
137
|
|
|
$('[data-toggle="tooltip"]').tooltip(); |
|
138
|
|
|
} |
|
139
|
|
|
}); |
|
140
|
|
|
|
|
141
|
|
|
datatablesBasic.buttons().container().appendTo( $('.col-md-6:eq(0)', datatablesBasic.table().container() ) ); |
|
142
|
|
|
|
|
143
|
|
|
var datatablesFixed = $('.datatables-fixed').DataTable({ |
|
144
|
|
|
"searching": false, |
|
145
|
|
|
"lengthChange": false, |
|
146
|
|
|
"scrollX": true, |
|
147
|
|
|
fixedHeader: true, |
|
148
|
|
|
fixedColumns: true, |
|
149
|
|
|
//dom: 'Bfrtip', |
|
150
|
|
|
buttons: [ |
|
151
|
|
|
{ |
|
152
|
|
|
extend: 'copy', |
|
153
|
|
|
className: 'btn btn-default' |
|
154
|
|
|
}, |
|
155
|
|
|
{ |
|
156
|
|
|
extend: 'excel', |
|
157
|
|
|
className: 'btn btn-default' , |
|
158
|
|
|
footer: true, |
|
159
|
|
|
messageTop: function () { |
|
160
|
|
|
var headerPeriode = $('.header-periode').text(); |
|
161
|
|
|
return headerPeriode; |
|
162
|
|
|
}, |
|
163
|
|
|
|
|
164
|
|
|
messageBottom: function () { |
|
165
|
|
|
|
|
166
|
|
|
var footerPrint = $('.footer-print').text(); |
|
167
|
|
|
|
|
168
|
|
|
return footerPrint; |
|
169
|
|
|
}, |
|
170
|
|
|
}, |
|
171
|
|
|
{ |
|
172
|
|
|
extend: 'csv', |
|
173
|
|
|
className: 'btn btn-default' |
|
174
|
|
|
}, |
|
175
|
|
|
{ |
|
176
|
|
|
extend: 'pdf', |
|
177
|
|
|
className: 'btn btn-default', |
|
178
|
|
|
footer: true, |
|
179
|
|
|
messageTop: function () { |
|
180
|
|
|
printCounter++; |
|
181
|
|
|
|
|
182
|
|
|
var headerPrint = $('.header-print').html(); |
|
183
|
|
|
var headerPeriode = $('.header-periode').html(); |
|
184
|
|
|
if ( printCounter === 1 ) { |
|
185
|
|
|
return headerPrint+headerPeriode+'This is the first time you have printed this document.'; |
|
186
|
|
|
} |
|
187
|
|
|
else { |
|
|
|
|
|
|
188
|
|
|
return headerPrint+headerPeriode+'You have printed this document '+printCounter+' times'; |
|
189
|
|
|
} |
|
190
|
|
|
}, |
|
191
|
|
|
|
|
192
|
|
|
messageBottom: function () { |
|
193
|
|
|
|
|
194
|
|
|
var footerPrint = $('.footer-print').html(); |
|
195
|
|
|
|
|
196
|
|
|
return footerPrint; |
|
197
|
|
|
}, |
|
198
|
|
|
|
|
199
|
|
|
}, |
|
200
|
|
|
{ |
|
201
|
|
|
extend: 'print', |
|
202
|
|
|
className: 'btn btn-default', |
|
203
|
|
|
footer: true, |
|
204
|
|
|
messageTop: function () { |
|
205
|
|
|
printCounter++; |
|
206
|
|
|
|
|
207
|
|
|
var headerPrint = $('.header-print').html(); |
|
208
|
|
|
var headerPeriode = $('.header-periode').html(); |
|
209
|
|
|
if ( printCounter === 1 ) { |
|
210
|
|
|
return headerPrint+headerPeriode+'This is the first time you have printed this document.'; |
|
211
|
|
|
} |
|
212
|
|
|
else { |
|
|
|
|
|
|
213
|
|
|
return headerPrint+headerPeriode+'You have printed this document '+printCounter+' times'; |
|
214
|
|
|
} |
|
215
|
|
|
}, |
|
216
|
|
|
|
|
217
|
|
|
messageBottom: function () { |
|
218
|
|
|
|
|
219
|
|
|
var footerPrint = $('.footer-print').html(); |
|
220
|
|
|
|
|
221
|
|
|
return footerPrint; |
|
222
|
|
|
}, |
|
223
|
|
|
}, |
|
224
|
|
|
], |
|
225
|
|
|
drawCallback: function (settings) { |
|
|
|
|
|
|
226
|
|
|
$('[data-toggle="tooltip"]').tooltip(); |
|
227
|
|
|
} |
|
228
|
|
|
}); |
|
229
|
|
|
|
|
230
|
|
|
datatablesFixed.buttons().container().appendTo( $('.col-md-6:eq(0)', datatablesFixed.table().container() ) ); |
|
231
|
|
|
} |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
export default new Admin; |